# -*- coding: utf-8 -*-

"""
@File    : 03_读取文本栅格展示.py
@Author  : fungis@163.com
@notice  :
"""
import numpy
# import pandas as pd
import matplotlib.pyplot as plt

data = numpy.loadtxt(r'./data-use/table/test.txt', encoding='gbk')  # 读取文本数据
# data = pd.read_excel(r'./data-use/test.xls') # 读取表格数据

# 调用figure创建一个绘图对象
fig = plt.figure()
ax = fig.add_subplot()

ticks = numpy.arange(0, 10, 1)  # 生成0-10，步长为1
# 生成刻度
ax.set_yticks(ticks)
plt.imshow(data, cmap='tab10')
plt.colorbar()  # 绘制图例
plt.show()
